$(function() {
	eachprolist(JSON.parse(sessionStorage.getItem("prolist")).productList);
})

//判断类型
function getprotype(ptype) {
	var ptyperesult;
	switch(ptype) {
		case 0:
		ptyperesult = "无抵押";
			break;
		case 1:
		ptyperesult = "房产抵押";
			break;
		case 2:
		ptyperesult = "车贷抵押";
			break;
	}
return ptyperesult;
}

function eachprolist(list) {
	
	$.each(list, function(i) {
		$(".projectbox").append(
			"<div class='product'>" +
			"<div class='productname'>" +
			"<span class='p_name'>产品" + (i + 1) + "</span>" +
			"<img class='icon_hot' src='images/projecticon"+(i + 1)+".png'/>" +
			"</div>" +
			"<p class='edu'>可贷额度（万元）</p>" +
			"<p class='edumoney'>"+this.productMoney+"万元</p>" +
			"<div class='fangkuanbox'>" +
			"<span class='tittle'>放款时间：</span>" +
			"<span class='fangkuantime'>"+this.productCreationTime+"</span>" +
			"</div>" +
			"<div class='fangkuanbox'>" +
			"<div>" +
			"<span class='tittle'>月       利      率：</span>" +
			"<span class='yueli'>"+this.productInterest+"</span>" +
			"</div>" +
			"<div>" +
			"<span class='tittle'>还款期限：</span>" +
			"<span class='qixian'>"+this.productDeadline+"</span>" +
			"</div>" +
			"</div>" +
			"<div class='type'>" +
			"<span class='tittle'>类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型：</span>" +
			"<span class='type1'>"+getprotype(this.productType)+"</span>" +
			"</div>" +
			"<button class='apply' onclick='submitproapply()'>立即申请</button>" +
			"</div>"
		);
	});
}
function submitproapply(){
	$.post("/addapply.action",function(data){
		console.log(data);
	})
}
$('.apply').click(function() {
	$('.zhezhao').css('display', 'block')
})
$('.tipshow').click(function() {
	$('.zhezhao').css('display', 'none')
})